package com.guchenbo.tomcat;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

import javax.annotation.Resource;
import javax.servlet.MultipartConfigElement;

@SpringBootApplication
public class DemoApplication {
    protected static final Logger log = LoggerFactory.getLogger(DemoApplication.class);
    @Resource
    private ReqResServlet reqResServlet;
    @Resource
    private MultipartConfigElement multipartConfigElement;

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @Bean
    public ServletRegistrationBean reqResServletServletRegistrationBean() {
        ServletRegistrationBean<ReqResServlet> bean = new ServletRegistrationBean<>(reqResServlet, "/reqResServlet");
        bean.setMultipartConfig(multipartConfigElement);
        return bean;
    }
}
